﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Core;
using Hangfire;
using Microsoft.AspNetCore.Mvc;
using Model;
using NLog;
using WebApp.Models;
using WebApp.Serivces;

namespace WebApp.Controllers
{
    /// <summary>
    /// 首页
    /// </summary>
    public class HomeController : Controller
    {
        private readonly IBaseService _baseService;
        private readonly Logger log = LogManager.GetCurrentClassLogger();
        private readonly IFireServices _fireServices;
        /// <summary>
        /// 首页
        /// </summary>
        /// <param name="baseService"></param>
        /// <param name="fireServices"></param>
        public HomeController(IBaseService baseService, IFireServices fireServices)
        {
            _baseService = baseService;
            _fireServices = fireServices;
        }
        /// <summary>
        /// 首页
        /// </summary>
        /// <returns></returns>
        public IActionResult Index()
        {
            //log.Debug("测试2");
            //_fireServices.SendTempMsg(56);
            BackgroundJob.Schedule(() => _fireServices.OpenActivity(56),DateTime.Now.AddSeconds(30));
            return View();
        }
        public IActionResult About()
        {
            ViewData["Message"] = "Your application description page.";

            return View();
        }

        public IActionResult Contact()
        {
            ViewData["Message"] = "Your contact page.";

            return View();
        }

        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }
    }
}
